package router

import (
	systemController "gitee.com/wangshh_123/cross-pay-go/src/controller/system"
	"gitee.com/wangshh_123/cross-pay-go/src/middleware"
	"github.com/gin-gonic/gin"
)

// SetupPlatformSwitchRoutes 设置平台切换相关路由
func SetupPlatformSwitchRoutes(r *gin.Engine) {
	// 用户平台切换路由组
	platformSwitch := r.Group("/api/platform/switch")
	platformSwitch.Use(middleware.AuthMiddleware())
	{
		platformSwitchController := systemController.NewPlatformSwitchController()

		// 检查平台切换约束
		platformSwitch.GET("/check", platformSwitchController.CheckSwitchConstraints)

		// 执行平台切换
		platformSwitch.POST("/execute", platformSwitchController.ExecutePlatformSwitch)

		// 获取平台切换日志
		platformSwitch.GET("/logs", platformSwitchController.GetSwitchLogs)
	}

	// 管理员平台切换路由组
	adminPlatformSwitch := r.Group("/api/admin/platform/switch")
	adminPlatformSwitch.Use(middleware.AuthMiddleware(), middleware.AdminMiddleware())
	{
		platformSwitchController := systemController.NewPlatformSwitchController()

		// 管理员检查用户平台切换约束
		adminPlatformSwitch.GET("/check/:user_id", platformSwitchController.AdminCheckUserSwitchConstraints)

		// 管理员执行用户平台切换
		adminPlatformSwitch.POST("/execute/:user_id", platformSwitchController.AdminExecuteUserPlatformSwitch)
	}
}
